<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../css/common.css" />
<script src="../js/common/jquery.js"></script>
<script src="../js/common/drag.js"></script>
<script src="../js/common/angular.min.js"></script>
<script type="text/javascript" src="../js/common/common.js"></script>
<script type="text/javascript" src="../js/serviceAjax.js"></script>
</head>
<body ng-app="myApp">

<div class="dqwz">
    <span>当前位置：</span>
    <span>AngularJS Ajax</span>
</div>

<section>
    <div ng-controller="menuCtrl">
        <h3>【向服务器获取json数据】</h3>
        <ul>
            <li ng-repeat="x in sites">
                <a href="{{x.Url}}" target="_black">{{x.Name + '' + x.Country}}</a>
            </li>
            <span class="red">{{info}}</span>
        </ul>
        <!-- 查看源码开始 -->
        <div class="htmlCode">
            <span>【html源码】</span>
            <xmp ng-non-bindable>
<ul>
    <li ng-repeat="x in sites">
        <a href="{{x.Url}}" target="_black">{{x.Name + '' + x.Country}}</a>
    </li>
    <span class="red">{{info}}</span>
</ul>
            </xmp>
            <span>【js源码】</span>
            <xmp>
app.controller('menuCtrl',function($scope,$rootScope,$http){
    $http({
        method:'GET',
        url:'../php/menu.php',
    }).then(function successCallback(reponse){
        $scope.sites = reponse.data.sites;
    },function errorCallback(reponse){
        $rootScope.info = '请求失败';
    })
})
            </xmp>
            <span>【php源码】</span>
            <xmp>
{
    "sites": [
        {
            "Name": "菜鸟教程",
            "Url": "http://www.runoob.com",
            "Country": "CN"
        },
        {
            "Name": "Google",
            "Url": "http://www.google.com",
            "Country": "USA"
        },
        {
            "Name": "Facebook",
            "Url": "http://www.facebook.com",
            "Country": "USA"
        },
        {
            "Name": "微博",
            "Url": "http://www.weibo.com",
            "Country": "CN"
        }
    ]
}
            </xmp>
            <span class="close"><a href="javascript:;">关闭</a></span>
        </div>
        <div class="viewCode">
            <span><a href="javascript:;"> >>查看源码</a></span>
        </div>
        <!-- 查看源码结束 -->
    </div>
</section>

<div class="mask_layer">
</div>

</body>
</html>